const int N = 2e5 + 5;
const ll inf = 1e18;
ll val1[N], val2[N];
struct node {
  int l, r;
  ll s1, s2, lz, mi;
} tr[N << 2];

void push_up(int u) {
  tr[u].mi = min(tr[u << 1].mi, tr[u << 1 | 1].mi);
}

void push_dw(int u, ll v) {
  tr[u].s2 += v;
  tr[u].lz += v;
  tr[u].mi += v;
}

void push_dw(int u) {
  if (tr[u].lz) {
    push_dw(u << 1, tr[u].lz);
    push_dw(u << 1 | 1, tr[u].lz);
    tr[u].lz = 0;
  }
}

void build(int u, int l, int r) {
  tr[u] = {l, r, 0, 0, 0, inf};
  if (l == r) {
    tr[u].s1 = val1[l];
    tr[u].s2 = val2[l];
    tr[u].mi = val1[l] + val2[l];
    // debug(l, val1[l], val2[l]);
    return;
  }
  int mid = (l + r) >> 1;
  build(u << 1, l, mid);
  build(u << 1 | 1, mid + 1, r);
  push_up(u);
}

void modify(int u, int l, int r, ll v) {
  if (tr[u].l >= l && tr[u].r <= r) {
    push_dw(u, v);
    return;
  }
  push_dw(u);
  int mid = (tr[u].l + tr[u].r) >> 1;
  if (l <= mid) {
    modify(u << 1, l, r, v);
  }
  if (r > mid) {
    modify(u << 1 | 1, l, r, v);
  }
  push_up(u);
}

void modify2(int u, int p, ll v) {
  if (tr[u].l == tr[u].r) {
    tr[u].s1 = v;
    tr[u].mi = tr[u].s1 + tr[u].s2;
    return;
  }
  push_dw(u);
  int mid = (tr[u].l + tr[u].r) >> 1;
  if (p <= mid) {
    modify2(u << 1, p, v);
  } else {
    modify2(u << 1 | 1, p, v);
  }
  push_up(u);
}

ll query(int u, int l, int r) {
  if (tr[u].l >= l && tr[u].r <= r) {
    return tr[u].mi;
  }
  push_dw(u);
  int mid = (tr[u].l + tr[u].r) >> 1;
  ll mi = inf;
  if (l <= mid) {
    mi = min(mi, query(u << 1, l, r));
  }
  if (r > mid) {
    mi = min(mi, query(u << 1 | 1, l, r));
  }
  return mi;
}

ll query2(int u, int p) {
  if (tr[u].l == tr[u].r) {
    return tr[u].s2;
  }
  push_dw(u);
  int mid = (tr[u].l + tr[u].r) >> 1;
  if (p <= mid) {
    return query2(u << 1, p);
  }
  return query2(u << 1 | 1, p);
}
void solve()
{
  int n, q;
  cin >> n >> q;

  vi to_root(n + 1);
  vvi g(n + 1);
  vl val3(n + 1);
  vector<tuple<int, int, int>> edges;

  rep(i, 2, n) {
    int u, v, w;
    cin >> u >> v >> w;
    g[u].pb(v);
    val3[v] = w;
    edges.pb({u, v, w});
  }

  rep(i, 2, n) {
    int u, v, w;
    cin >> u >> v >> w;
    to_root[u] = w;
    edges.pb({u, v, w});
  }

  vi L(n + 1), R(n + 1), id(n + 1);
  int tim = 0;
  auto dfs = [&](auto &&dfs, int u, ll s) -> void {
    L[u] = ++tim;
    id[tim] = u;
    val3[u] += s;
    for (auto &v : g[u]) {
      dfs(dfs, v, val3[u]);
    }
    R[u] = tim;
  };
  dfs(dfs, 1, 0);
  rep(i, 1, n) {
    val1[i] = to_root[id[i]];
    val2[i] = val3[id[i]];
  }
  build(1, 1, n);

  while (q--) {
    int op, w;
    cin >> op;
    if (op == 1) {
      int p;
      cin >> p >> w;
      p--;
      if (p < n - 1) {
        int u = get<1>(edges[p]), w2 = get<2>(edges[p]);
        modify(1, L[u], R[u], -w2);
        modify(1, L[u], R[u], w);
        get<2>(edges[p]) = w;
      } else {
        int u = get<0>(edges[p]);
        modify2(1, L[u], w);
      }
    } else {
      int u, v;
      cin >> u >> v;
      if (L[u] <= L[v] && L[v] <= R[u]) {
        cout << query2(1, L[v]) - query2(1, L[u]) << '\n';
      } else {
        cout << query(1, L[u], R[u]) - query2(1, L[u]) + query2(1, L[v]) << '\n';
      }
    }
  }
}